<!DOCTYPE HTML>
<html lang="en" >
    <!-- Start book 美多商城 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>使用乐观锁并发下单 | 美多商城</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../orders/commit/orders-success.html" />
    
    
    <link rel="prev" href="../../orders/commit/transaction.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="8.2.4"
        data-chapter-title="使用乐观锁并发下单"
        data-filepath="orders/commit/lock.md"
        data-basepath="../.."
        data-revision="Fri Mar 08 2019 10:51:59 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        美多商城
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="project-preparation.html">
            
                
                    <a href="../../project-preparation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        项目准备
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="project-preparation/project-introduce.html">
            
                
                    <a href="../../project-preparation/project-introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        美多商城项目介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="project-preparation/project-introduce/project-demand-analysis.html">
            
                
                    <a href="../../project-preparation/project-introduce/project-demand-analysis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.1.</b>
                        
                        项目需求分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="project-preparation/project-introduce/project-architecture-design.html">
            
                
                    <a href="../../project-preparation/project-introduce/project-architecture-design.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.2.</b>
                        
                        项目架构设计
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="project-preparation/project-create-configuration.html">
            
                
                    <a href="../../project-preparation/project-create-configuration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        工程创建和配置
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="project-preparation/project-create-configuration/create-project.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/create-project.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.1.</b>
                        
                        创建工程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="project-preparation/project-create-configuration/development-environment.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/development-environment.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.2.</b>
                        
                        配置开发环境
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="project-preparation/project-create-configuration/jinja2-template.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/jinja2-template.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.3.</b>
                        
                        配置Jinja2模板引擎
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="project-preparation/project-create-configuration/mysql.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/mysql.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.4.</b>
                        
                        配置MySQL数据库
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="project-preparation/project-create-configuration/redis.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/redis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.5.</b>
                        
                        配置Redis数据库
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="project-preparation/project-create-configuration/log.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/log.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.6.</b>
                        
                        配置工程日志
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="project-preparation/project-create-configuration/static.html">
            
                
                    <a href="../../project-preparation/project-create-configuration/static.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.7.</b>
                        
                        配置前端静态文件
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="user-register.html">
            
                
                    <a href="../../user-register.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        用户注册
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="user-register/prepare-user-app.html">
            
                
                    <a href="../../user-register/prepare-user-app.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        展示用户注册界面
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="user-register/prepare-user-app/create-user-app.html">
            
                
                    <a href="../../user-register/prepare-user-app/create-user-app.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.1.</b>
                        
                        创建用户模块应用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="user-register/prepare-user-app/add-module-path.html">
            
                
                    <a href="../../user-register/prepare-user-app/add-module-path.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.2.</b>
                        
                        追加导包路径
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="user-register/prepare-user-app/show-user-register-html.html">
            
                
                    <a href="../../user-register/prepare-user-app/show-user-register-html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.3.</b>
                        
                        展示用户注册界面
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="user-register/user-model.html">
            
                
                    <a href="../../user-register/user-model.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        用户模型类
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="user-register/user-model/custom-user-model.html">
            
                
                    <a href="../../user-register/user-model/custom-user-model.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.1.</b>
                        
                        定义用户模型类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="user-register/user-model/migrate-custom-user-model.html">
            
                
                    <a href="../../user-register/user-model/migrate-custom-user-model.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.2.</b>
                        
                        迁移用户模型类
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="user-register/user-register.html">
            
                
                    <a href="../../user-register/user-register.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        用户注册业务实现
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="user-register/user-register/user-register-analyze.html">
            
                
                    <a href="../../user-register/user-register/user-register-analyze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        用户注册业务逻辑分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="user-register/user-register/user-register-project-definition.html">
            
                
                    <a href="../../user-register/user-register/user-register-project-definition.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.2.</b>
                        
                        用户注册接口设计和定义
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="user-register/user-register/user-register-front-logic.html">
            
                
                    <a href="../../user-register/user-register/user-register-front-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.3.</b>
                        
                        用户注册前端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="user-register/user-register/user-register-end-logic.html">
            
                
                    <a href="../../user-register/user-register/user-register-end-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.4.</b>
                        
                        用户注册后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="user-register/user-register/user-register-keep-state.html">
            
                
                    <a href="../../user-register/user-register/user-register-keep-state.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.5.</b>
                        
                        状态保持
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="user-register/user-register/user-register-username-repetition.html">
            
                
                    <a href="../../user-register/user-register/user-register-username-repetition.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.6.</b>
                        
                        用户名重复注册
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="user-register/user-register/user-register-mobile-repetition.html">
            
                
                    <a href="../../user-register/user-register/user-register-mobile-repetition.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.7.</b>
                        
                        手机号重复注册
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="user-verification-code.html">
            
                
                    <a href="../../user-verification-code.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        验证码
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="user-verification-code/image-verification-code.html">
            
                
                    <a href="../../user-verification-code/image-verification-code.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        图形验证码
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="user-verification-code/image-verification-code/image-verification-code-analyze.html">
            
                
                    <a href="../../user-verification-code/image-verification-code/image-verification-code-analyze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.1.</b>
                        
                        图形验证码逻辑分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="user-verification-code/image-verification-code/image-verification-code-project-definition.html">
            
                
                    <a href="../../user-verification-code/image-verification-code/image-verification-code-project-definition.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.2.</b>
                        
                        图形验证码接口设计和定义
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="user-verification-code/image-verification-code/image-verification-code-end-logic.html">
            
                
                    <a href="../../user-verification-code/image-verification-code/image-verification-code-end-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.3.</b>
                        
                        图形验证码后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="user-verification-code/image-verification-code/image-verification-code-front-logic.html">
            
                
                    <a href="../../user-verification-code/image-verification-code/image-verification-code-front-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.4.</b>
                        
                        图形验证码前端逻辑
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="user-verification-code/sms-verification-code.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        短信验证码
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="user-verification-code/sms-verification-code/sms-verification-code-analyze.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/sms-verification-code-analyze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.1.</b>
                        
                        短信验证码逻辑分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="user-verification-code/sms-verification-code/rong-lian-yun.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/rong-lian-yun.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.2.</b>
                        
                        容联云通讯短信平台
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="user-verification-code/sms-verification-code/sms-verification-code-end-logic.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/sms-verification-code-end-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.3.</b>
                        
                        短信验证码后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2.4" data-path="user-verification-code/sms-verification-code/sms-verification-code-front-logic.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/sms-verification-code-front-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.4.</b>
                        
                        短信验证码前端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2.5" data-path="user-verification-code/sms-verification-code/add-register-logic.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/add-register-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.5.</b>
                        
                        补充注册时短信验证逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2.6" data-path="user-verification-code/sms-verification-code/sms-verification-code-often.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/sms-verification-code-often.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.6.</b>
                        
                        避免频繁发送短信验证码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2.7" data-path="user-verification-code/sms-verification-code/sms-verification-code-redis-pipeline.html">
            
                
                    <a href="../../user-verification-code/sms-verification-code/sms-verification-code-redis-pipeline.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.7.</b>
                        
                        pipeline操作Redis数据库
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="user-verification-code/celery-async-send-code.html">
            
                
                    <a href="../../user-verification-code/celery-async-send-code.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        异步方案RabbitMQ和Celery
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="user-verification-code/celery-async-send-code/rabiitmq-introduce.html">
            
                
                    <a href="../../user-verification-code/celery-async-send-code/rabiitmq-introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.1.</b>
                        
                        RabbitMQ介绍和使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="user-verification-code/celery-async-send-code/celery-introduce.html">
            
                
                    <a href="../../user-verification-code/celery-async-send-code/celery-introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.2.</b>
                        
                        Celery介绍和使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="user-login.html">
            
                
                    <a href="../../user-login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        用户登录
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="user-login/account-login.html">
            
                
                    <a href="../../user-login/account-login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        账号登录
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="user-login/account-login/username-login.html">
            
                
                    <a href="../../user-login/account-login/username-login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.1.</b>
                        
                        用户名登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="user-login/account-login/many-account-login.html">
            
                
                    <a href="../../user-login/account-login/many-account-login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.2.</b>
                        
                        多账号登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="user-login/account-login/index-show-username.html">
            
                
                    <a href="../../user-login/account-login/index-show-username.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.3.</b>
                        
                        首页用户名展示
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="user-login/account-login/logout.html">
            
                
                    <a href="../../user-login/account-login/logout.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.4.</b>
                        
                        退出登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.1.5" data-path="user-login/account-login/islogin.html">
            
                
                    <a href="../../user-login/account-login/islogin.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.5.</b>
                        
                        判断用户是否登录
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="user-login/qq-login.html">
            
                
                    <a href="../../user-login/qq-login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        QQ登录
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1" data-path="user-login/qq-login/qq-login-document.html">
            
                
                    <a href="../../user-login/qq-login/qq-login-document.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.1.</b>
                        
                        QQ登录开发文档
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2.2" data-path="user-login/qq-login/qq-login-model.html">
            
                
                    <a href="../../user-login/qq-login/qq-login-model.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.2.</b>
                        
                        定义QQ登录模型类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2.3" data-path="user-login/qq-login/qq-login-tool.html">
            
                
                    <a href="../../user-login/qq-login/qq-login-tool.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.3.</b>
                        
                        QQ登录工具QQLoginTool
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2.4" data-path="user-login/qq-login/qq-login-oauth-openid.html">
            
                
                    <a href="../../user-login/qq-login/qq-login-oauth-openid.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.4.</b>
                        
                        OAuth2.0认证获取openid
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2.5" data-path="user-login/qq-login/qq-login-bind-user.html">
            
                
                    <a href="../../user-login/qq-login/qq-login-bind-user.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.5.</b>
                        
                        openid是否绑定用户的处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2.6" data-path="user-login/qq-login/qq-login-bind-user-implementation.html">
            
                
                    <a href="../../user-login/qq-login/qq-login-bind-user-implementation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.6.</b>
                        
                        openid绑定用户实现
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="user-center.html">
            
                
                    <a href="../../user-center.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        用户中心
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="user-center/user-info.html">
            
                
                    <a href="../../user-center/user-info.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        用户基本信息
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="user-center/user-info/user-info-logic.html">
            
                
                    <a href="../../user-center/user-info/user-info-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.1.</b>
                        
                        用户基本信息逻辑分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="user-center/user-info/user-info-end-logic.html">
            
                
                    <a href="../../user-center/user-info/user-info-end-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.2.</b>
                        
                        查询并渲染用户基本信息
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="user-center/add-verification-email.html">
            
                
                    <a href="../../user-center/add-verification-email.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        添加和验证邮箱
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.1" data-path="user-center/add-verification-email/add-email-end-logic.html">
            
                
                    <a href="../../user-center/add-verification-email/add-email-end-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.1.</b>
                        
                        添加邮箱后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2.2" data-path="user-center/add-verification-email/send-email-setting.html">
            
                
                    <a href="../../user-center/add-verification-email/send-email-setting.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.2.</b>
                        
                        Django发送邮件的配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2.3" data-path="user-center/add-verification-email/send-verification-email.html">
            
                
                    <a href="../../user-center/add-verification-email/send-verification-email.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.3.</b>
                        
                        发送邮箱验证邮件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2.4" data-path="user-center/add-verification-email/verification-email-end-logic.html">
            
                
                    <a href="../../user-center/add-verification-email/verification-email-end-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.4.</b>
                        
                        验证邮箱后端逻辑
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="user-center/addresses-manage.html">
            
                
                    <a href="../../user-center/addresses-manage.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        收货地址
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.3.1" data-path="user-center/areas.html">
            
                
                    <a href="../../user-center/areas.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.1.</b>
                        
                        省市区三级联动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3.2" data-path="user-center/create-address.html">
            
                
                    <a href="../../user-center/create-address.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.2.</b>
                        
                        新增地址前后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3.3" data-path="user-center/query-address.html">
            
                
                    <a href="../../user-center/query-address.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.3.</b>
                        
                        展示地址前后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3.4" data-path="user-center/update-address.html">
            
                
                    <a href="../../user-center/update-address.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.4.</b>
                        
                        修改地址前后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3.5" data-path="user-center/delete-address.html">
            
                
                    <a href="../../user-center/delete-address.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.5.</b>
                        
                        删除地址前后端逻辑
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3.6" data-path="user-center/default-address.html">
            
                
                    <a href="../../user-center/default-address.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.6.</b>
                        
                        设置默认地址
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3.7" data-path="user-center/update-address-title.html">
            
                
                    <a href="../../user-center/update-address-title.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.7.</b>
                        
                        修改地址标题
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="user-center/change-password.html">
            
                
                    <a href="../../user-center/change-password.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        修改密码
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="goods.html">
            
                
                    <a href="../../goods.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        商品
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="goods/goods-db-tables-design.html">
            
                
                    <a href="../../goods/goods-db-tables-design.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        商品数据库表设计
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1" data-path="goods/goods-db-tables-design/spu-sku.html">
            
                
                    <a href="../../goods/goods-db-tables-design/spu-sku.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.1.</b>
                        
                        SPU和SKU
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.1.2" data-path="goods/goods-db-tables-design/contents-tables-analyze.html">
            
                
                    <a href="../../goods/goods-db-tables-design/contents-tables-analyze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.2.</b>
                        
                        首页广告数据库表分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.1.3" data-path="goods/goods-db-tables-design/goods-data-tables-analyze.html">
            
                
                    <a href="../../goods/goods-db-tables-design/goods-data-tables-analyze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.3.</b>
                        
                        商品信息数据库表分析
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="goods/prepare-goods-data.html">
            
                
                    <a href="../../goods/prepare-goods-data.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        准备商品数据
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.2.1" data-path="goods/prepare-goods-data/fastdfs.html">
            
                
                    <a href="../../goods/prepare-goods-data/fastdfs.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.1.</b>
                        
                        文件存储方案FastDFS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2.2" data-path="goods/prepare-goods-data/docker-basics.html">
            
                
                    <a href="../../goods/prepare-goods-data/docker-basics.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.2.</b>
                        
                        容器化方案Docker
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2.3" data-path="goods/prepare-goods-data/implementation-file-storage-download.html">
            
                
                    <a href="../../goods/prepare-goods-data/implementation-file-storage-download.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.3.</b>
                        
                        Docker和FastDFS上传和下载文件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2.4" data-path="goods/prepare-goods-data/import-goods-data.html">
            
                
                    <a href="../../goods/prepare-goods-data/import-goods-data.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.4.</b>
                        
                        录入商品数据
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="goods/index.html">
            
                
                    <a href="../../goods/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        首页广告
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.3.1" data-path="goods/index/show-channels-categories.html">
            
                
                    <a href="../../goods/index/show-channels-categories.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.1.</b>
                        
                        展示首页商品分类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3.2" data-path="goods/index/show-index-contents.html">
            
                
                    <a href="../../goods/index/show-index-contents.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.2.</b>
                        
                        展示首页商品广告
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3.3" data-path="goods/prepare-goods-data/customstorage-tool.html">
            
                
                    <a href="../../goods/prepare-goods-data/customstorage-tool.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.3.</b>
                        
                        自定义Django文件存储类
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="goods/goods-list.html">
            
                
                    <a href="../../goods/goods-list.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        商品列表页
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.4.1" data-path="goods/page-structure-analyze.html">
            
                
                    <a href="../../goods/page-structure-analyze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.1.</b>
                        
                        商品列表页分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4.2" data-path="goods/goods-list/crumbs-nav.html">
            
                
                    <a href="../../goods/goods-list/crumbs-nav.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.2.</b>
                        
                        列表页面包屑导航
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4.3" data-path="goods/pagination-sort.html">
            
                
                    <a href="../../goods/pagination-sort.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.3.</b>
                        
                        列表页分页和排序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4.4" data-path="goods/sales-sort.html">
            
                
                    <a href="../../goods/sales-sort.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.4.</b>
                        
                        列表页热销排行
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="goods/goods-search.html">
            
                
                    <a href="../../goods/goods-search.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        商品搜索
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.5.1" data-path="goods/goods-search/full-text-search-es.html">
            
                
                    <a href="../../goods/goods-search/full-text-search-es.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.1.</b>
                        
                        全文检索方案Elasticsearch
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5.2" data-path="goods/goods-search/haystack-create-index.html">
            
                
                    <a href="../../goods/goods-search/haystack-create-index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.2.</b>
                        
                        Haystack扩展建立索引
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5.3" data-path="goods/goods-search/render-search-result.html">
            
                
                    <a href="../../goods/goods-search/render-search-result.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.3.</b>
                        
                        渲染商品搜索结果
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="goods/detail.html">
            
                
                    <a href="../../goods/detail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        商品详情页
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.6.1" data-path="goods/detail/analyze-prepare.html">
            
                
                    <a href="../../goods/detail/analyze-prepare.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.1.</b>
                        
                        商品详情页分析和准备
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6.2" data-path="goods/detail/show-detail-data.html">
            
                
                    <a href="../../goods/detail/show-detail-data.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.2.</b>
                        
                        展示详情页数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6.3" data-path="goods/detail/statistics-category-goods-views-count.html">
            
                
                    <a href="../../goods/detail/statistics-category-goods-views-count.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.3.</b>
                        
                        统计分类商品访问量
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="goods/user-browse-history.html">
            
                
                    <a href="../../goods/user-browse-history.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        用户浏览记录
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.7.1" data-path="goods/user-browse-history/browse-history-save-scheme.html">
            
                
                    <a href="../../goods/user-browse-history/browse-history-save-scheme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.1.</b>
                        
                        设计浏览记录存储方案
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7.2" data-path="goods/user-browse-history/save-query-browse-history.html">
            
                
                    <a href="../../goods/user-browse-history/save-query-browse-history.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.2.</b>
                        
                        保存和查询浏览记录
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="carts.html">
            
                
                    <a href="../../carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        购物车
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="carts/carts-save-scheme.html">
            
                
                    <a href="../../carts/carts-save-scheme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        购物车存储方案
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="carts/carts-management.html">
            
                
                    <a href="../../carts/carts-management.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        购物车管理
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.2.1" data-path="carts/addcarts.html">
            
                
                    <a href="../../carts/addcarts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.1.</b>
                        
                        添加购物车
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2.2" data-path="carts/query-carts.html">
            
                
                    <a href="../../carts/query-carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.2.</b>
                        
                        展示购物车
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2.3" data-path="carts/update-carts.html">
            
                
                    <a href="../../carts/update-carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.3.</b>
                        
                        修改购物车
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2.4" data-path="carts/delete-carts.html">
            
                
                    <a href="../../carts/delete-carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.4.</b>
                        
                        删除购物车
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2.5" data-path="carts/all-select-carts.html">
            
                
                    <a href="../../carts/all-select-carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.5.</b>
                        
                        全选购物车
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2.6" data-path="carts/merge-carts.html">
            
                
                    <a href="../../carts/merge-carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.6.</b>
                        
                        合并购物车
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="carts/show-goods-page-carts.html">
            
                
                    <a href="../../carts/show-goods-page-carts.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        展示商品页面简单购物车
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="orders.html">
            
                
                    <a href="../../orders.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        订单
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="orders/settlement.html">
            
                
                    <a href="../../orders/settlement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        结算订单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="orders/commit.html">
            
                
                    <a href="../../orders/commit.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.</b>
                        
                        提交订单
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.2.1" data-path="orders/commit/createorders-tables.html">
            
                
                    <a href="../../orders/commit/createorders-tables.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.1.</b>
                        
                        创建订单数据库表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2.2" data-path="orders/commit/save-orders-goods-info.html">
            
                
                    <a href="../../orders/commit/save-orders-goods-info.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.2.</b>
                        
                        保存订单基本信息和订单商品信息
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2.3" data-path="orders/commit/transaction.html">
            
                
                    <a href="../../orders/commit/transaction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.3.</b>
                        
                        使用事务保存订单数据
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="8.2.4" data-path="orders/commit/lock.html">
            
                
                    <a href="../../orders/commit/lock.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.4.</b>
                        
                        使用乐观锁并发下单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2.5" data-path="orders/commit/orders-success.html">
            
                
                    <a href="../../orders/commit/orders-success.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.5.</b>
                        
                        展示提交订单成功页面
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="orders/info.html">
            
                
                    <a href="../../orders/info.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.3.</b>
                        
                        我的订单
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9" data-path="payment.html">
            
                
                    <a href="../../payment.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        支付
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="payment/alipay-introduce.html">
            
                
                    <a href="../../payment/alipay-introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        支付宝介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="payment/alipay-payment-sys.html">
            
                
                    <a href="../../payment/alipay-payment-sys.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.</b>
                        
                        对接支付宝系统
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.2.1" data-path="payment/alipay-payment/order-payment-functions.html">
            
                
                    <a href="../../payment/alipay-payment/order-payment-functions.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.1.</b>
                        
                        订单支付功能
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.2.2" data-path="payment/alipay-payment/save-payment-result.html">
            
                
                    <a href="../../payment/alipay-payment/save-payment-result.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.2.</b>
                        
                        保存订单支付结果
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9.3" data-path="payment/comment-order-goods.html">
            
                
                    <a href="../../payment/comment-order-goods.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.3.</b>
                        
                        评价订单商品
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.3.1" data-path="payment/comment-order-goods/goods-judge-implementation.html">
            
                
                    <a href="../../payment/comment-order-goods/goods-judge-implementation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.3.1.</b>
                        
                        评价订单商品
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.3.2" data-path="payment/comment-order-goods/detail-show-goods-judge-info.html">
            
                
                    <a href="../../payment/comment-order-goods/detail-show-goods-judge-info.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.3.2.</b>
                        
                        详情页展示评价信息
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" data-path="wpo.html">
            
                
                    <a href="../../wpo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        性能优化
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1" data-path="wpo/html-static.html">
            
                
                    <a href="../../wpo/html-static.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.</b>
                        
                        页面静态化
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1.1" data-path="wpo/html-static/static-html.html">
            
                
                    <a href="../../wpo/html-static/static-html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.1.</b>
                        
                        首页广告页面静态化
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.1.2" data-path="wpo/html-static/goods-detail-static.html">
            
                
                    <a href="../../wpo/html-static/goods-detail-static.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.2.</b>
                        
                        商品详情页面静态化
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="wpo/mysql-read-write.html">
            
                
                    <a href="../../wpo/mysql-read-write.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.</b>
                        
                        MySQL读写分离
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.2.1" data-path="wpo/mysql-read-write/master-slave.html">
            
                
                    <a href="../../wpo/mysql-read-write/master-slave.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.1.</b>
                        
                        MySQL主从同步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.2.2" data-path="wpo/mysql-read-write/django-db-read-write-separate.html">
            
                
                    <a href="../../wpo/mysql-read-write/django-db-read-write-separate.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.2.</b>
                        
                        Django实现MySQL读写分离
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="11" data-path="deploy.html">
            
                
                    <a href="../../deploy.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        部署
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="11.1" data-path="deploy/nginx-static-logic.html">
            
                
                    <a href="../../deploy/nginx-static-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.1.</b>
                        
                        Nginx部署静态数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.2" data-path="deploy/nginx-reverse-proxy-logic.html">
            
                
                    <a href="../../deploy/nginx-reverse-proxy-logic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.2.</b>
                        
                        Nginx反向代理动态业务
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >美多商城</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x4F7F;&#x7528;&#x4E50;&#x89C2;&#x9501;&#x5E76;&#x53D1;&#x4E0B;&#x5355;">&#x4F7F;&#x7528;&#x4E50;&#x89C2;&#x9501;&#x5E76;&#x53D1;&#x4E0B;&#x5355;</h1>
<blockquote>
<p><strong>&#x91CD;&#x8981;&#x63D0;&#x793A;&#xFF1A;</strong></p>
</blockquote>
<ul>
<li>&#x5728;&#x591A;&#x4E2A;&#x7528;&#x6237;&#x540C;&#x65F6;&#x53D1;&#x8D77;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x5546;&#x54C1;&#x7684;&#x4E0B;&#x5355;&#x8BF7;&#x6C42;&#x65F6;&#xFF0C;&#x5148;&#x67E5;&#x8BE2;&#x5546;&#x54C1;&#x5E93;&#x5B58;&#xFF0C;&#x518D;&#x4FEE;&#x6539;&#x5546;&#x54C1;&#x5E93;&#x5B58;&#xFF0C;&#x4F1A;&#x51FA;&#x73B0;&#x8D44;&#x6E90;&#x7ADE;&#x4E89;&#x95EE;&#x9898;&#xFF0C;&#x5BFC;&#x81F4;&#x5E93;&#x5B58;&#x7684;&#x6700;&#x7EC8;&#x7ED3;&#x679C;&#x51FA;&#x73B0;&#x5F02;&#x5E38;&#x3002;</li>
</ul>
<h3 id="1-&#x5E76;&#x53D1;&#x4E0B;&#x5355;&#x95EE;&#x9898;&#x6F14;&#x793A;&#x548C;&#x89E3;&#x51B3;&#x65B9;&#x6848;">1. &#x5E76;&#x53D1;&#x4E0B;&#x5355;&#x95EE;&#x9898;&#x6F14;&#x793A;&#x548C;&#x89E3;&#x51B3;&#x65B9;&#x6848;</h3>
<p><img src="../images/04&#x5E76;&#x53D1;&#x4E0B;&#x5355;&#x95EE;&#x9898;&#x6F14;&#x793A;.png" style="zoom:50%"></p>
<blockquote>
<p><strong>&#x89E3;&#x51B3;&#x529E;&#x6CD5;&#xFF1A;</strong></p>
</blockquote>
<ul>
<li><p>&#x60B2;&#x89C2;&#x9501;</p>
<ul>
<li><p>&#x5F53;&#x67E5;&#x8BE2;&#x67D0;&#x6761;&#x8BB0;&#x5F55;&#x65F6;&#xFF0C;&#x5373;&#x8BA9;&#x6570;&#x636E;&#x5E93;&#x4E3A;&#x8BE5;&#x8BB0;&#x5F55;&#x52A0;&#x9501;&#xFF0C;&#x9501;&#x4F4F;&#x8BB0;&#x5F55;&#x540E;&#x522B;&#x4EBA;&#x65E0;&#x6CD5;&#x64CD;&#x4F5C;&#xFF0C;&#x4F7F;&#x7528;&#x7C7B;&#x4F3C;&#x5982;&#x4E0B;&#x8BED;&#x6CD5;</p>
<pre><code class="lang-python">select stock <span class="hljs-keyword">from</span> tb_sku where id=<span class="hljs-number">1</span> <span class="hljs-keyword">for</span> update;

SKU.objects.select_for_update().get(id=<span class="hljs-number">1</span>)
</code></pre>
</li>
<li>&#x60B2;&#x89C2;&#x9501;&#x7C7B;&#x4F3C;&#x4E8E;&#x6211;&#x4EEC;&#x5728;&#x591A;&#x7EBF;&#x7A0B;&#x8D44;&#x6E90;&#x7ADE;&#x4E89;&#x65F6;&#x6DFB;&#x52A0;&#x7684;&#x4E92;&#x65A5;&#x9501;&#xFF0C;&#x5BB9;&#x6613;&#x51FA;&#x73B0;&#x6B7B;&#x9501;&#x73B0;&#x8C61;&#xFF0C;&#x91C7;&#x7528;&#x4E0D;&#x591A;&#x3002;</li>
</ul>
</li>
<li><p>&#x4E50;&#x89C2;&#x9501;</p>
<ul>
<li><p>&#x4E50;&#x89C2;&#x9501;&#x5E76;&#x4E0D;&#x662F;&#x771F;&#x5B9E;&#x5B58;&#x5728;&#x7684;&#x9501;&#xFF0C;&#x800C;&#x662F;&#x5728;&#x66F4;&#x65B0;&#x7684;&#x65F6;&#x5019;&#x5224;&#x65AD;&#x6B64;&#x65F6;&#x7684;&#x5E93;&#x5B58;&#x662F;&#x5426;&#x662F;&#x4E4B;&#x524D;&#x67E5;&#x8BE2;&#x51FA;&#x7684;&#x5E93;&#x5B58;&#xFF0C;&#x5982;&#x679C;&#x76F8;&#x540C;&#xFF0C;&#x8868;&#x793A;&#x6CA1;&#x4EBA;&#x4FEE;&#x6539;&#xFF0C;&#x53EF;&#x4EE5;&#x66F4;&#x65B0;&#x5E93;&#x5B58;&#xFF0C;&#x5426;&#x5219;&#x8868;&#x793A;&#x522B;&#x4EBA;&#x62A2;&#x8FC7;&#x8D44;&#x6E90;&#xFF0C;&#x4E0D;&#x518D;&#x6267;&#x884C;&#x5E93;&#x5B58;&#x66F4;&#x65B0;&#x3002;&#x7C7B;&#x4F3C;&#x5982;&#x4E0B;&#x64CD;&#x4F5C;</p>
<pre><code class="lang-python">update tb_sku set stock=<span class="hljs-number">2</span> where id=<span class="hljs-number">1</span> <span class="hljs-keyword">and</span> stock=<span class="hljs-number">7</span>;

SKU.objects.filter(id=<span class="hljs-number">1</span>, stock=<span class="hljs-number">7</span>).update(stock=<span class="hljs-number">2</span>)
</code></pre>
</li>
</ul>
</li>
<li>&#x4EFB;&#x52A1;&#x961F;&#x5217;<ul>
<li>&#x5C06;&#x4E0B;&#x5355;&#x7684;&#x903B;&#x8F91;&#x653E;&#x5230;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#xFF08;&#x5982;celery&#xFF09;&#xFF0C;&#x5C06;&#x5E76;&#x884C;&#x8F6C;&#x4E3A;&#x4E32;&#x884C;&#xFF0C;&#x6240;&#x6709;&#x4EBA;&#x6392;&#x961F;&#x4E0B;&#x5355;&#x3002;&#x6BD4;&#x5982;&#x5F00;&#x542F;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x8FDB;&#x7A0B;&#x7684;Celery&#xFF0C;&#x4E00;&#x4E2A;&#x8BA2;&#x5355;&#x4E00;&#x4E2A;&#x8BA2;&#x5355;&#x7684;&#x5904;&#x7406;&#x3002;</li>
</ul>
</li>
</ul>
<h3 id="2-&#x4F7F;&#x7528;&#x4E50;&#x89C2;&#x9501;&#x5E76;&#x53D1;&#x4E0B;&#x5355;">2. &#x4F7F;&#x7528;&#x4E50;&#x89C2;&#x9501;&#x5E76;&#x53D1;&#x4E0B;&#x5355;</h3>
<blockquote>
<p>&#x601D;&#x8003;&#xFF1A;</p>
<ul>
<li>&#x4E0B;&#x5355;&#x6210;&#x529F;&#x7684;&#x6761;&#x4EF6;&#x662F;&#x4EC0;&#x4E48;&#xFF1F;<ul>
<li>&#x9996;&#x5148;&#x5E93;&#x5B58;&#x5927;&#x4E8E;&#x8D2D;&#x4E70;&#x91CF;&#xFF0C;&#x7136;&#x540E;&#x66F4;&#x65B0;&#x5E93;&#x5B58;&#x548C;&#x9500;&#x91CF;&#x65F6;&#x539F;&#x59CB;&#x5E93;&#x5B58;&#x6CA1;&#x53D8;&#x3002;</li>
</ul>
</li>
</ul>
<p>&#x7ED3;&#x8BBA;&#xFF1A;</p>
<ul>
<li>&#x6240;&#x4EE5;&#x5728;&#x7528;&#x6237;&#x5E93;&#x5B58;&#x6EE1;&#x8DB3;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5982;&#x679C;&#x66F4;&#x65B0;&#x5E93;&#x5B58;&#x548C;&#x9500;&#x91CF;&#x65F6;&#x539F;&#x59CB;&#x5E93;&#x5B58;&#x6709;&#x53D8;&#xFF0C;&#x90A3;&#x4E48;&#x7EE7;&#x7EED;&#x7ED9;&#x7528;&#x6237;&#x4E0B;&#x5355;&#x7684;&#x673A;&#x4F1A;&#x3002;</li>
</ul>
</blockquote>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OrderCommitView</span><span class="hljs-params">(LoginRequiredJSONMixin, View)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;&#x8BA2;&#x5355;&#x63D0;&#x4EA4;&quot;&quot;&quot;</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">post</span><span class="hljs-params">(self, request)</span>:</span>
        <span class="hljs-string">&quot;&quot;&quot;&#x4FDD;&#x5B58;&#x8BA2;&#x5355;&#x4FE1;&#x606F;&#x548C;&#x8BA2;&#x5355;&#x5546;&#x54C1;&#x4FE1;&#x606F;&quot;&quot;&quot;</span>
        <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;&#x4FDD;&#x5B58;&#x8BA2;&#x5355;&#x65F6;&#x9700;&#x8981;&#x7684;&#x4FE1;&#x606F;</span>
        ......

        <span class="hljs-comment"># &#x663E;&#x5F0F;&#x7684;&#x5F00;&#x542F;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;</span>
        <span class="hljs-keyword">with</span> transaction.atomic():
            <span class="hljs-comment"># &#x521B;&#x5EFA;&#x4E8B;&#x52A1;&#x4FDD;&#x5B58;&#x70B9;</span>
            save_id = transaction.savepoint()

            <span class="hljs-comment"># &#x66B4;&#x529B;&#x56DE;&#x6EDA;</span>
            <span class="hljs-keyword">try</span>:
                <span class="hljs-comment"># &#x4FDD;&#x5B58;&#x8BA2;&#x5355;&#x57FA;&#x672C;&#x4FE1;&#x606F; OrderInfo&#xFF08;&#x4E00;&#xFF09;</span>
                order = OrderInfo.objects.create(
                    order_id=order_id,
                    user=user,
                    address=address,
                    total_count=<span class="hljs-number">0</span>,
                    total_amount=Decimal(<span class="hljs-string">&apos;0&apos;</span>),
                    freight=Decimal(<span class="hljs-string">&apos;10.00&apos;</span>),
                    pay_method=pay_method,
                    status=OrderInfo.ORDER_STATUS_ENUM[<span class="hljs-string">&apos;UNPAID&apos;</span>] <span class="hljs-keyword">if</span> pay_method == OrderInfo.PAY_METHODS_ENUM[<span class="hljs-string">&apos;ALIPAY&apos;</span>] <span class="hljs-keyword">else</span>
                    OrderInfo.ORDER_STATUS_ENUM[<span class="hljs-string">&apos;UNSEND&apos;</span>]
                )

                <span class="hljs-comment"># &#x4ECE;redis&#x8BFB;&#x53D6;&#x8D2D;&#x7269;&#x8F66;&#x4E2D;&#x88AB;&#x52FE;&#x9009;&#x7684;&#x5546;&#x54C1;&#x4FE1;&#x606F;</span>
                redis_conn = get_redis_connection(<span class="hljs-string">&apos;carts&apos;</span>)
                redis_cart = redis_conn.hgetall(<span class="hljs-string">&apos;carts_%s&apos;</span> % user.id)
                selected = redis_conn.smembers(<span class="hljs-string">&apos;selected_%s&apos;</span> % user.id)
                carts = {}
                <span class="hljs-keyword">for</span> sku_id <span class="hljs-keyword">in</span> selected:
                    carts[int(sku_id)] = int(redis_cart[sku_id])
                sku_ids = carts.keys()

                <span class="hljs-comment"># &#x904D;&#x5386;&#x8D2D;&#x7269;&#x8F66;&#x4E2D;&#x88AB;&#x52FE;&#x9009;&#x7684;&#x5546;&#x54C1;&#x4FE1;&#x606F;</span>
                <span class="hljs-keyword">for</span> sku_id <span class="hljs-keyword">in</span> sku_ids:
                    <span class="hljs-keyword">while</span> <span class="hljs-keyword">True</span>:
                        <span class="hljs-comment"># &#x67E5;&#x8BE2;SKU&#x4FE1;&#x606F;</span>
                        sku = SKU.objects.get(id=sku_id)

                        <span class="hljs-comment"># &#x8BFB;&#x53D6;&#x539F;&#x59CB;&#x5E93;&#x5B58;</span>
                        origin_stock = sku.stock
                        origin_sales = sku.sales

                        <span class="hljs-comment"># &#x5224;&#x65AD;SKU&#x5E93;&#x5B58;</span>
                        sku_count = carts[sku.id]
                        <span class="hljs-keyword">if</span> sku_count &gt; origin_stock:
                            <span class="hljs-comment"># &#x4E8B;&#x52A1;&#x56DE;&#x6EDA;</span>
                            transaction.savepoint_rollback(save_id)
                            <span class="hljs-keyword">return</span> http.JsonResponse({<span class="hljs-string">&apos;code&apos;</span>: RETCODE.STOCKERR, <span class="hljs-string">&apos;errmsg&apos;</span>: <span class="hljs-string">&apos;&#x5E93;&#x5B58;&#x4E0D;&#x8DB3;&apos;</span>})

                        <span class="hljs-comment"># &#x6A21;&#x62DF;&#x5EF6;&#x8FDF;</span>
                        <span class="hljs-comment"># import time</span>
                        <span class="hljs-comment"># time.sleep(5)</span>

                        <span class="hljs-comment"># SKU&#x51CF;&#x5C11;&#x5E93;&#x5B58;&#xFF0C;&#x589E;&#x52A0;&#x9500;&#x91CF;</span>
                        <span class="hljs-comment"># sku.stock -= sku_count</span>
                        <span class="hljs-comment"># sku.sales += sku_count</span>
                        <span class="hljs-comment"># sku.save()</span>

                        <span class="hljs-comment"># &#x4E50;&#x89C2;&#x9501;&#x66F4;&#x65B0;&#x5E93;&#x5B58;&#x548C;&#x9500;&#x91CF;</span>
                        new_stock = origin_stock - sku_count
                        new_sales = origin_sales + sku_count
                        result = SKU.objects.filter(id=sku_id, stock=origin_stock).update(stock=new_stock, sales=new_sales)
                        <span class="hljs-comment"># &#x5982;&#x679C;&#x4E0B;&#x5355;&#x5931;&#x8D25;&#xFF0C;&#x4F46;&#x662F;&#x5E93;&#x5B58;&#x8DB3;&#x591F;&#x65F6;&#xFF0C;&#x7EE7;&#x7EED;&#x4E0B;&#x5355;&#xFF0C;&#x76F4;&#x5230;&#x4E0B;&#x5355;&#x6210;&#x529F;&#x6216;&#x8005;&#x5E93;&#x5B58;&#x4E0D;&#x8DB3;&#x4E3A;&#x6B62;</span>
                        <span class="hljs-keyword">if</span> result == <span class="hljs-number">0</span>:
                            <span class="hljs-keyword">continue</span>

                        <span class="hljs-comment"># &#x4FEE;&#x6539;SPU&#x9500;&#x91CF;</span>
                        sku.spu.sales += sku_count
                        sku.spu.save()

                        <span class="hljs-comment"># &#x4FDD;&#x5B58;&#x8BA2;&#x5355;&#x5546;&#x54C1;&#x4FE1;&#x606F; OrderGoods&#xFF08;&#x591A;&#xFF09;</span>
                        OrderGoods.objects.create(
                            order=order,
                            sku=sku,
                            count=sku_count,
                            price=sku.price,
                        )

                        <span class="hljs-comment"># &#x4FDD;&#x5B58;&#x5546;&#x54C1;&#x8BA2;&#x5355;&#x4E2D;&#x603B;&#x4EF7;&#x548C;&#x603B;&#x6570;&#x91CF;</span>
                        order.total_count += sku_count
                        order.total_amount += (sku_count * sku.price)

                        <span class="hljs-comment"># &#x4E0B;&#x5355;&#x6210;&#x529F;&#x6216;&#x8005;&#x5931;&#x8D25;&#x5C31;&#x8DF3;&#x51FA;&#x5FAA;&#x73AF;</span>
                        <span class="hljs-keyword">break</span>

                <span class="hljs-comment"># &#x6DFB;&#x52A0;&#x90AE;&#x8D39;&#x548C;&#x4FDD;&#x5B58;&#x8BA2;&#x5355;&#x4FE1;&#x606F;</span>
                order.total_amount += order.freight
                order.save()
            <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
                logger.error(e)
                <span class="hljs-comment"># &#x4E8B;&#x52A1;&#x56DE;&#x6EDA;</span>
                transaction.savepoint_rollback(save_id)
                <span class="hljs-keyword">return</span> http.JsonResponse({<span class="hljs-string">&apos;code&apos;</span>: RETCODE.DBERR, <span class="hljs-string">&apos;errmsg&apos;</span>: <span class="hljs-string">&apos;&#x4E0B;&#x5355;&#x5931;&#x8D25;&apos;</span>})

        <span class="hljs-comment"># &#x4FDD;&#x5B58;&#x8BA2;&#x5355;&#x6570;&#x636E;&#x6210;&#x529F;&#xFF0C;&#x663E;&#x5F0F;&#x7684;&#x63D0;&#x4EA4;&#x4E00;&#x6B21;&#x4E8B;&#x52A1;</span>
        transaction.savepoint_commit(save_id)

        <span class="hljs-comment"># &#x6E05;&#x9664;&#x8D2D;&#x7269;&#x8F66;&#x4E2D;&#x5DF2;&#x7ED3;&#x7B97;&#x7684;&#x5546;&#x54C1;</span>
        pl = redis_conn.pipeline()
        pl.hdel(<span class="hljs-string">&apos;carts_%s&apos;</span> % user.id, *selected)
        pl.srem(<span class="hljs-string">&apos;selected_%s&apos;</span> % user.id, *selected)
        pl.execute()

        <span class="hljs-comment"># &#x54CD;&#x5E94;&#x63D0;&#x4EA4;&#x8BA2;&#x5355;&#x7ED3;&#x679C;</span>
        <span class="hljs-keyword">return</span> http.JsonResponse({<span class="hljs-string">&apos;code&apos;</span>: RETCODE.OK, <span class="hljs-string">&apos;errmsg&apos;</span>: <span class="hljs-string">&apos;&#x4E0B;&#x5355;&#x6210;&#x529F;&apos;</span>, <span class="hljs-string">&apos;order_id&apos;</span>: order.order_id})
</code></pre>
<h3 id="3-mysql&#x4E8B;&#x52A1;&#x9694;&#x79BB;&#x7EA7;&#x522B;">3. MySQL&#x4E8B;&#x52A1;&#x9694;&#x79BB;&#x7EA7;&#x522B;</h3>
<ul>
<li><p>&#x4E8B;&#x52A1;&#x9694;&#x79BB;&#x7EA7;&#x522B;&#x6307;&#x7684;&#x662F;&#x5728;&#x5904;&#x7406;&#x540C;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x7684;&#x591A;&#x4E2A;&#x4E8B;&#x52A1;&#x4E2D;&#xFF0C;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x4FEE;&#x6539;&#x6570;&#x636E;&#x540E;&#xFF0C;&#x5176;&#x4ED6;&#x4E8B;&#x52A1;&#x4F55;&#x65F6;&#x80FD;&#x770B;&#x5230;&#x4FEE;&#x6539;&#x540E;&#x7684;&#x7ED3;&#x679C;&#x3002;</p>
</li>
<li><p>MySQL&#x6570;&#x636E;&#x5E93;&#x4E8B;&#x52A1;&#x9694;&#x79BB;&#x7EA7;&#x522B;&#x4E3B;&#x8981;&#x6709;&#x56DB;&#x79CD;&#xFF1A;</p>
<ul>
<li><code>Serializable</code>&#xFF1A;&#x4E32;&#x884C;&#x5316;&#xFF0C;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x7684;&#x6267;&#x884C;&#x3002;</li>
<li><code>Repeatable read</code>&#xFF1A;&#x53EF;&#x91CD;&#x590D;&#x8BFB;&#xFF0C;&#x65E0;&#x8BBA;&#x5176;&#x4ED6;&#x4E8B;&#x52A1;&#x662F;&#x5426;&#x4FEE;&#x6539;&#x5E76;&#x63D0;&#x4EA4;&#x4E86;&#x6570;&#x636E;&#xFF0C;&#x5728;&#x8FD9;&#x4E2A;&#x4E8B;&#x52A1;&#x4E2D;&#x770B;&#x5230;&#x7684;&#x6570;&#x636E;&#x503C;&#x59CB;&#x7EC8;&#x4E0D;&#x53D7;&#x5176;&#x4ED6;&#x4E8B;&#x52A1;&#x5F71;&#x54CD;&#x3002;</li>
<li><code>Read committed</code>&#xFF1A;&#x8BFB;&#x53D6;&#x5DF2;&#x63D0;&#x4EA4;&#xFF0C;&#x5176;&#x4ED6;&#x4E8B;&#x52A1;&#x63D0;&#x4EA4;&#x4E86;&#x5BF9;&#x6570;&#x636E;&#x7684;&#x4FEE;&#x6539;&#x540E;&#xFF0C;&#x672C;&#x4E8B;&#x52A1;&#x5C31;&#x80FD;&#x8BFB;&#x53D6;&#x5230;&#x4FEE;&#x6539;&#x540E;&#x7684;&#x6570;&#x636E;&#x503C;&#x3002;</li>
<li><code>Read uncommitted</code>&#xFF1A;&#x8BFB;&#x53D6;&#x672A;&#x63D0;&#x4EA4;&#xFF0C;&#x5176;&#x4ED6;&#x4E8B;&#x52A1;&#x53EA;&#x8981;&#x4FEE;&#x6539;&#x4E86;&#x6570;&#x636E;&#xFF0C;&#x5373;&#x4F7F;&#x672A;&#x63D0;&#x4EA4;&#xFF0C;&#x672C;&#x4E8B;&#x52A1;&#x4E5F;&#x80FD;&#x770B;&#x5230;&#x4FEE;&#x6539;&#x540E;&#x7684;&#x6570;&#x636E;&#x503C;&#x3002;</li>
<li>MySQL&#x6570;&#x636E;&#x5E93;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528;&#x53EF;&#x91CD;&#x590D;&#x8BFB;&#xFF08; Repeatable read&#xFF09;&#x3002;</li>
</ul>
</li>
<li><p>&#x4F7F;&#x7528;&#x4E50;&#x89C2;&#x9501;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5982;&#x679C;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x4FEE;&#x6539;&#x4E86;&#x5E93;&#x5B58;&#x5E76;&#x63D0;&#x4EA4;&#x4E86;&#x4E8B;&#x52A1;&#xFF0C;&#x90A3;&#x5176;&#x4ED6;&#x7684;&#x4E8B;&#x52A1;&#x5E94;&#x8BE5;&#x53EF;&#x4EE5;&#x8BFB;&#x53D6;&#x5230;&#x4FEE;&#x6539;&#x540E;&#x7684;&#x6570;&#x636E;&#x503C;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x53EF;&#x91CD;&#x590D;&#x8BFB;&#x7684;&#x9694;&#x79BB;&#x7EA7;&#x522B;&#xFF0C;&#x5E94;&#x8BE5;&#x4FEE;&#x6539;&#x4E3A;&#x8BFB;&#x53D6;&#x5DF2;&#x63D0;&#x4EA4;&#xFF08;Read committed&#xFF09;&#x3002;</p>
</li>
<li><p>&#x4FEE;&#x6539;&#x65B9;&#x5F0F;&#xFF1A;</p>
</li>
</ul>
<p><img src="../images/03&#x4FEE;&#x6539;&#x4E8B;&#x52A1;&#x9694;&#x79BB;&#x7EA7;&#x522B;1.png" style="zoom:50%"></p>
<p><img src="../images/03&#x4FEE;&#x6539;&#x4E8B;&#x52A1;&#x9694;&#x79BB;&#x7EA7;&#x522B;2.png" style="zoom:50%"></p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../orders/commit/transaction.html" class="navigation navigation-prev " aria-label="Previous page: 使用事务保存订单数据"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../orders/commit/orders-success.html" class="navigation navigation-next " aria-label="Next page: 展示提交订单成功页面"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"toggle-chapters":{},"expandable-chapters":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book 美多商城 -->
</html>
